<template>
	<view>
		<view class="may">
			<button class="btn" @click="btn">点我付款</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		methods:{
			dismay(v){
				//预付单
				uni.request({
					url:"http://api.100qhl.com:5024/v1/order/createOrder",
					method:"GET",
					data:{
						openid:v,
						name:'钢铁侠',
						moyle:0.01,
						code:'asdasdafdfsdfs'+ parseInt(Math.random()*10000),
						payType:1,
						clientIp:"223.181.42.36",
					},
					success(res) {
						console.log(res);
						uni.requestPayment({
							orderInfo:"weixin",
							timeStamp:"",
							nonceStr:"",
							package:"",
							signType:"",
							paySign:"",
							success(res) {
								console.log(res);
							},
							fail(err) {
								console.log(err);
							}
						})
					}
				})
				// uni.requestPayment({
					
				// })
			},
			btn(){
					let _this = this
				uni.login({
					success(res) {
						// console.log(res);
						let {code} = res
						uni.request({
							url:"https://api.weixin.qq.com/sns/jscode2session",
							method:"GET",
							data:{
								appid:"wx99f053d2da99dbfd",
								secret:"a0c8a11d1f663de246bc54747deca00c",
								js_code:code,
								grant_type:"authorization_code"
							},
							success(res) {
								console.log(res);
								_this.dismay(res.data)
								
							}
						})
					}
					
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
